<?php

namespace App\CustomTrait;


trait UrlTrait
{

  /**
   * 验证文件是否携带后缀
   * @param $url
   * @return bool
   */
  public function suffix($url)
  {
    $preg = "/^http(s)?:\\/\\/.+\.(html|php|dhtml|xhtml|shtml|asp|jsp|jspx|aspx|cgi|htm)$/";
    if (preg_match($preg, $url)) {
      return true;
    } else {
      return false;
    }
  }

  public function handle($url)
  {



    if ($this->suffix($url)) {
      //携带后缀

    }
    return $url;
  }

}